<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/calendar.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function back(){
		var customerId = "<c:out value='${customerId}'/>";
		var sign = "<c:out value='${sign}'/>";
		if(sign != ""){
			window.parent.location.href = "./customerManage.do?action=customerDetail&customerId="+customerId+"&sign="+sign;
		}else if(sign == "s1"){
			parent.window.location.href = "./saleRecord.do?action=deptSaleRecord";
		}else{
			parent.window.location.href = "./saleRecord.do";
		}
		window.location.target = "main";
	}

	function download(){
		var currentValue = document.all.added.value;
		if(currentValue != "" && currentValue != "0"){
			document.viewSaleRecordInfoForm.action = "./saleRecord.do?action=download";
			document.viewSaleRecordInfoForm.target = "vSaleRecord";
			document.viewSaleRecordInfoForm.submit();
		}else{
			alert("请选择附件！");
		}
		
	}
	
	function initPage(){
		if("<c:out value='${saleRecord}'/>" == ""){
			var nodes = document.viewSaleRecordInfoForm.elements;
			for(var i = 0; i < nodes.length; i++){
				var node = document.viewSaleRecordInfoForm.elements[i];
				node.disabled = true;
			}
		}else{
			var nodes = document.viewSaleRecordInfoForm.elements;
			for(var i = 0; i < nodes.length; i++){
				var node = document.viewSaleRecordInfoForm.elements[i];
				node.disabled = false;
			}
		}
	}
-->
</script>
</head>
<body onload="initPage()">
<form name="viewSaleRecordInfoForm" action="" method="post">
	<table class="table_add">
		<tr>
			<td colspan="4" class="title_top">
				主题：&nbsp;&nbsp;&nbsp;&nbsp;${saleRecord.subject}
			</td>
		</tr>
		<tr>
			<td class="title1" style="width: 155px;">预测签约时间：</td>
			<td width="35%"><fmt:formatDate value='${saleRecord.predictContract}' pattern='yyyy-MM-dd'/>&nbsp;</td>
			<td class="title1" style="width: 155px;">预测签约金额：</td>
			<td width="35%">￥<fmt:formatNumber value="${saleRecord.predictCost}" pattern="###,###,###,###.##"/> 元</td>
		</tr>
		<tr>
			<td class="title1">商机需求描述：</td>
			<td colspan="3" class="textarea_vdesc" valign="top"><pre>${saleRecord.customerRequireDesc}</pre>&nbsp;</td>
		</tr>
		<tr>
			<td class="title">销售代表：</td>
			<td>${saleRecord.salePerson}&nbsp;</td>
			<td class="title" width="155">制单人：</td>
			<td>${saleRecord.createPerson}&nbsp;</td>
		</tr>
		<tr>
			<td class="title">本记录的销售阶段：</td>
			<td>
				<c:forEach var="saleStage" items="${saleStages}">
					<c:if test='${saleRecord.saleStageId == saleStage.stageCode}'>${saleStage.stageName}</c:if>
				</c:forEach>&nbsp;
			</td>
			<td class="title">制单时间：</td>
			<td><fmt:formatDate value='${saleRecord.createDate}' pattern='yyyy-MM-dd HH:mm'/>&nbsp;</td>
		</tr>
		<tr>
			<td class="title">本次联系时间：</td>
			<td>
				<fmt:formatDate value='${saleRecord.contactDate}' pattern='yyyy-MM-dd'/> 
				<c:choose>
					<c:when test="${saleRecord.contactTime == 1}">上午</c:when>
					<c:when test="${saleRecord.contactTime == 2}">下午</c:when>
					<c:otherwise></c:otherwise>
				</c:choose>&nbsp;
			</td>
			<td class="title">联系方式：</td>
			<td>
				<c:forEach var="contactWay" items="${contactWays}">
					<c:if test='${saleRecord.contactWayId == contactWay.id}'>${contactWay.rangeValue}</c:if>
				</c:forEach>&nbsp;
			</td>
		</tr>
		<tr>
			<td class="title">下次计划联系时间：</td>
			<td>
				<fmt:formatDate value='${saleRecord.nextContactDate}' pattern='yyyy-MM-dd'/> 
				<c:choose>
					<c:when test="${saleRecord.nextContactTime == 1}">上午</c:when>
					<c:when test="${saleRecord.nextContactTime == 2}">下午</c:when>
					<c:otherwise></c:otherwise>
				</c:choose>&nbsp;
			</td>
			<td class="title">计划联系方式：</td>
			<td>
				<c:forEach var="contactWay" items="${contactWays}">
					<c:if test='${saleRecord.nextContactWayId == contactWay.id}'>${contactWay.rangeValue}</c:if>
				</c:forEach>&nbsp;
			</td>
		</tr>
		<tr>
			<td class="title">附件：</td>
			<td colspan="3">
				<select id="added" name="added" style="width: 75%">
					<option value="0">请选择</option>
					<c:forEach var="systemFile" items="${saleRecord.systemFiles}">
					<option value="${systemFile.id}">附件名称：${systemFile.fileName}，上传者：${systemFile.person}，上传时间：<fmt:formatDate value="${systemFile.uploadDate}" pattern="yyyy-MM-dd"/></option>
					</c:forEach>
				</select>&nbsp;
				<input class="" type="button" value="下 载 " onclick="download()">
			</td>
		</tr>
		<!-- 
		<tr>
			<td class="title">联系人：</td>
			<td>${saleRecord.linkman}</td>
		</tr>
		<tr>
			<td>产品报价：</td>
			<td>${saleRecord.productPrice}元</td>
		</tr>
		 -->
		<!-- 
		<tr>
			<td width="20%"><input type="checkbox"/>下次提醒：</td>
			<td>提前：1小时</td>
		</tr>
		 -->
		<tr>
			<td class="title">联系记录：</td>
			<td colspan="3" class="textarea_vdesc" valign="top"><pre>${saleRecord.requireDesc}</pre>&nbsp;</td>
		</tr>
	</table>
	<input id="id" name="id" type="hidden" value="${saleRecord.id}"/>
	<input id="customerName" name="customerName" type="hidden" value="${saleRecord.customerName}"/>
	<input id="customerId" name="customerId" type="hidden" value="${saleRecord.customerId}"/>
	<input id="currentUserId" name="currentUserId" type="hidden" value="${userId}"/>
</form>
</body>
</html>